package org.spark.core.transformations.scala

import org.spark.sparkUtil.SparkScalaContextUtil

/**
  * 功能概述:
  * Datetime:    2020/5/21   11:53
  * Author:   某人的目光
  */
object Filter {
  def main(args: Array[String]): Unit = {
    val sc = SparkScalaContextUtil.getSparkStart("filter");

    val numbers = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
    val numberRDD = sc.parallelize(numbers, 1)
    val evenNumberRDD = numberRDD.filter { num => num % 2 == 0 }

    evenNumberRDD.foreach { num => println(num) }
  }

}
